
layui.define(['jquery','form'], function (exports) {
	"use strict";
	var $ = layui.jquery,form=layui.form,object = {
		c: {data:[]}, // 配置项
		f: function (c) { // 数据初始化
			var s=new Date().getTime(),t = this;
			t.c.id = c.id?c.id:'simple_table_TS_UserInfo_BatchChangeOrg';
			t.c.tableId = c.tableelem?c.tableelem:'table-'+s;
			t.c.data = c.data; // 数据

			//将表单数据带入js
			t.c.formObj = c.formObj;
		},
        load:function () { // 加载控件
        	var h = ``
        		+ `<div class="layui-form layui-form-item" lay-filter="` + this.id + `" style="background-color: #ffffff;">`
    				+ `<label style="font-weight: 700;font-size: 18px; padding: 5px;">用户列表</label>`
        		+ `</div>`
            	+ `<div class="layui-form layui-form-item" pane>`
            		+ `<div id="`+this.c.tableId+`">`
            			+ this.loadTable()
            		+ `</div>`
        		+ `</div>`
    		+ `</div>`;
            $('#'+this.c.id).html(h);
            this.listenBtn();
        },
        loadTable:function () { // 加载表格
            return ``
        	+ `<div class="layui-table-box">`
        		+ `<div class="layui-table-header" style="height: 300px; max-height: 300px; overflow: auto; background-color: #ffffff;">`
	            	+ `<table cellspacing="0" cellpadding="0" border="0" class="layui-table" lay-skin="grid" lay-even="" style="margin: 0;">`
	            		+ `<thead>`
	            			+ this.loadTableOfThead()
	            		+ `</thead>`
	            		+ `<tbody>` + this.loadTableOfTbody()+`</tbody>`
	        		+ `</table>`
        		+ `</div>`
    		+ `</div>`;
        },
        loadTableOfThead:function () { // 加载表头
            var h = `<thead>`;
			h +=`<tr>`;
			h += `<th style="width:5%; text-align: center; color: #000000;">ID</th>`;
			h += `<th style="width:5%; text-align: center; color: #000000;">工号</th>`;
			h += `<th style="width:5%; text-align: center; color: #000000;">姓名</th>`;
            h += `</tr>`;
            h + `</thead>`;
			return h;
        },
        loadTableOfTbody:function () { // 加载表tbody
        	var t = this;
        	var h = `<tbody>`;
            for(var i=0;i<t.c.data.length;i++){
	            h += `<tr>`;
				h += `<td style="text-align:center; padding: 0;">` + t.c.data[i].id + `</td>`;
				h += `<td style="text-align:center; padding: 0;">` + t.c.data[i].userId + `</td>`;
				h += `<td style="text-align:center; padding: 0;">` + t.c.data[i].userName + `</td>`;
                h+= `</tr>`;
            }

            h += `</tbody>`;
			return h;
        },
        listenBtn:function () { // 添加监听
            var t = this;
        },
        getData:function () {
            return this.c.data;
        },
        init:function (c) {this.f(c);this.load();return object;},
        reload:function (c) {c.data = this.c.data;$('#' + this.c.id).empty();return this.init(c);}
	};
	exports('simple_table_TS_UserInfo_BatchChangeOrg', object);
});